﻿using System;
using System.Collections.Generic;
using System.Text;
using Tao.OpenGl;
using Tao.Platform.Windows;


namespace TaoGL_UserControl
{
    class PianoKey : InExPro
    {

        PianoKeyNormal m_PianoKeyNormal;
        PianoKeyLong m_PianoKeyLong;
        PianoKeyEnd m_PianoKeyEnd;

        public PianoKey()
        {
            m_PianoKeyNormal = new PianoKeyNormal();
            m_PianoKeyLong = new PianoKeyLong();
            m_PianoKeyEnd = new PianoKeyEnd();
        }
        //======================================================================
        public void SetLoc(float x, float y)
        {
            m_PianoKeyNormal.SetLoc(x, y);
            m_PianoKeyLong.SetLoc(x, y);
            m_PianoKeyEnd.SetLoc(x, y);

        }
        //======================================================================
        public void Draw()
        {
            Gl.glPushMatrix();
            Gl.glLoadIdentity();
            m_PianoKeyNormal.Draw();
            Gl.glLoadIdentity();
            m_PianoKeyEnd.Draw();
            Gl.glPopMatrix();

        }
        //======================================================================
        private float CountCnt = 0;
        public void Process(int tm)
        {
            CountCnt += 0.016f;
            if (CountCnt >= 1)
            {

                CountCnt = 0;
                m_PianoKeyEnd.Run(0);
            }

            m_PianoKeyNormal.DispRate(CountCnt);

            m_PianoKeyEnd.Process(tm);

            
        }
    }
}



